<template>
  <page-main>
    <template #right>
      <el-button type="default" icon="download" @click="handleExport('分配记录','/admin/settlementRecord/export', {})">导出</el-button>
    </template>
    <search-form ref="refSearchForm" @confirm="handleSearch" />
    <el-table
          v-loading="tableData.loading"
          ref="refTable"
          :data="tableData.list"
          stripe
          border
          style="width: 100%"
          row-key="id"
          :header-cell-style="tableData.headerCellStyle"
          :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
          @selection-change="selectCheckbox"
          >
          <el-table-column label="关联订单" prop="billId"/>
          <el-table-column label="用户id" prop="userId"/>
          <el-table-column label="城市公会" prop="branchGuildsName"/>
          <el-table-column label="城市会长ID" prop="cityFeeId"/>
          <el-table-column label="城市公会分润金额" prop="cityFee"/>
          <el-table-column label="分会" prop="cityGuildsName"/>
          <el-table-column label="分会长ID" prop="branchFeeId"/>
          <el-table-column label="分会分润金额" prop="branchFee"/>
          <el-table-column label="推荐人ID" prop="referrerFeeId"/>
          <el-table-column label="推荐人分润金额" prop="referrerFee"/>
          <el-table-column label="公司" prop="companyName"/>
          <el-table-column label="公司实际收入" prop="companyFee"/>
          <el-table-column label="是否执行" prop="status">
            <template #default="scope">
              {{proxy.$util.selectName(scope.row.status, optionData.yesno)}}
            </template>
          </el-table-column>
          <el-table-column label="创建时间" prop="createTime"/>
        </el-table>
        <el-pagination
          :current-page="pageData.current"
          :page-size="pageData.size"
          :page-sizes="pageData.pageSizes"
          :total="pageData.total"
          background
          style="padding: 30px 0; text-align: center;"
          layout="total, sizes, prev, pager, next, jumper"
          @current-change="getList"
          @size-change="sizeChange"
        />
        <show-detail ref="refShowDetail" />
  </page-main>
</template>

<script setup lang="ts">
// import {onMounted, ref, reactive, provide,defineAsyncComponent, getCurrentInstance, ComponentInternalInstance} from 'vue';
let obj = {
  pageApi: '/admin/settlementRecord/page',
  deleteApi: '/admin/settlementRule',
  primaryKey: 'ruleType',
  searchFixed:{},
}
import { useList } from '/@/assets/compositionFn/list';
let { dlgAddEdit, tableData, pageData, optionDataStore, getList, handleSearch, sizeChange, selectCheckbox, setDefaultCheckbox, handleOperate, handleDelete, handleDeleteMultiple, handleExport } = useList(obj);
const SearchForm = defineAsyncComponent(() => import('./components/SearchForm.vue'));
const AddEdit = defineAsyncComponent(() => import('./components/AddEdit.vue'));
const ShowDetail = defineAsyncComponent(() => import('./components/ShowDetail.vue'));
const {proxy} :any = getCurrentInstance() as ComponentInternalInstance;
const refSearchForm = ref();
const refTable = ref();
const refAddEdit = ref();
const refShowDetail = ref();
const optionData:any = reactive({});

provide('optionData', optionData);
const getInitData = async ()=>{
  optionData.settlementRuleType = await optionDataStore.getDictList('settlementRule_type');
  optionData.yesno = await optionDataStore.getDictList('yes_no_type');
};
onMounted(async () => {
  await getInitData();
  getList()
  
})
</script>

<style>

</style>